//
//  XLGDownloadDBOperation.h
//  etionCBLogic
//
//  Created by wjxfhxy on 15-2-27.
//  Copyright (c) 2015年 GuangZhouXuanWu. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "XLGDownloadIndex.h"

@interface XLGDownloadDBOperation : NSObject

- (id)initWithTablePath:(NSString*)tablePath;

- (NSInteger)addDownloadIndex:(XLGDownloadIndex *)mi;

- (void)getDownloadIndexCompletion:(void (^)(NSInteger nResult, NSArray *index))completion;

- (void)getFinishedIndexCompletion:(void(^)(NSInteger nResult, NSArray *index))completion;

- (void)getIndex:(XLGDownloadTargetType)targetType withSourceType:(NSUInteger)sourceType completion:(void (^)(NSInteger nResult, NSArray *index))completion;

- (void)getIndexWithExtendIDs:(NSArray*)extendIDs completion:(void (^)(NSInteger nResult, NSArray *index))completion;

- (void)getIndexWithURLs:(NSArray*)URLs completion:(void (^)(NSInteger nResult, NSArray *index))completion;

- (NSInteger)deleteIndexWithExtendID:(NSArray*)extendIDs;

- (NSInteger)deleteIndexWithURLs:(NSArray*)URLs;

//- (NSInteger)modifyDownloadIndexSerialNo:(NSInteger(^)(NSInteger(^modify)(NSUInteger serialNo,NSString* extendID)))block;

- (NSInteger)modifyDownloadIndexStatus:(NSInteger(^)(NSInteger(^modify)(NSUInteger serialNo,NSString* extendID,XLGDownloadStatusType status)))block;

- (NSInteger)modifyFinishDownloadIndex:(NSString*)extendID;

- (NSInteger)updateDownloadItem:(NSString *)extendID fileTotalByte:(NSUInteger)totalByte downloadByte:(NSUInteger)downloadByte;

@end
